//
//  UIViewEx.swift
//  Risac
//
//  Created by remy on 2017/11/17.
//  Copyright © 2017年 remy. All rights reserved.
//

import UIKit

extension UILabel {
    
    public convenience init(frame: CGRect = .zero,
                            text: String? = nil,
                            textColor: UIColor = .black,
                            fontSize: CGFloat = 17.0,
                            bold: Bool = false,
                            bgColor: UIColor = .clear,
                            alignment: NSTextAlignment = .left) {
        let font: UIFont = bold ? .boldSystemFont(ofSize: fontSize) : .systemFont(ofSize: fontSize)
        self.init(frame: frame, text: text, textColor: textColor, font: font, bgColor: bgColor, alignment: alignment)
    }
    
    public convenience init(frame: CGRect = .zero,
                            text: String? = nil,
                            textColor: UIColor = .black,
                            font: UIFont? = .systemFont(ofSize: 17.0),
                            bgColor: UIColor = .clear,
                            alignment: NSTextAlignment = .left) {
        self.init(frame: frame)
        self.text = text
        self.textColor = textColor
        self.font = font
        self.backgroundColor = bgColor
        self.textAlignment = alignment
    }
}
